<?php
    /**
     * 单利模式
     */
    class Single{
        static $instance=null;

        private function __construct(){
            echo 'class instance .<br>';
        }

       public static function getInstance(){
           if(is_null(self::$instance)){
               self::$instance=new self();
           }
           return self::$instance;
       }

       public function abc(){
           return 'abc';
       }
    }
?>